package com.jinghua.treatment.controller;

import com.jinghua.treatment.entity.SysNotice;
import com.jinghua.treatment.service.SysNoticeService;
import io.swagger.annotations.ApiOperation;
import jdk.nashorn.internal.ir.annotations.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * 公告及主页控制器
 * Created by 王兴光 on 2018/3/30.
 */
@Controller
@RequestMapping("/notice")
public class SysNoticeController {
    @Resource
    private SysNoticeService noticeService;

    @ApiOperation(value="添加公告及主页信息")
    @GetMapping(value="/insertNotice")
    @ResponseBody
    public int insertNotice(SysNotice notice){return noticeService.insert(notice);}

    @ApiOperation(value="根据医生编号，获取公告及主页信息")
    @GetMapping(value="/getNoticeById")
    @ResponseBody
    public SysNotice findNoticeById(Integer doctorId){return noticeService.selectByPrimaryKey(doctorId);}

    @ApiOperation(value="修改公告及主页信息")
    @GetMapping(value="/updateNotice")
    @ResponseBody
    public int updateNotice(SysNotice notice){return noticeService.updateByPrimaryKey(notice);}

}
